package com.rongxun.http;


import com.rongxun.hbwallet.constants.HttpConstants;
import com.rongxun.hbwallet.model.Response;
import com.rongxun.hbwallet.model.bean.ImageCode;
import com.rongxun.hbwallet.model.bean.CandyTask;
import com.rongxun.hbwallet.model.bean.Notice;
import com.rongxun.hbwallet.model.bean.SweetsInfo;
import com.rongxun.hbwallet.model.bean.Token;
import com.rongxun.hbwallet.model.bean.User;
import com.rongxun.hbwallet.model.bean.UserCandyInfo;
import com.rongxun.hbwallet.model.bean.UserCitymoneyInfo;

import java.util.List;
import java.util.Map;

import java.util.List;

import io.reactivex.Flowable;
import io.reactivex.Observable;
import okhttp3.RequestBody;
import retrofit2.http.Body;
import retrofit2.http.DELETE;
import retrofit2.http.Field;
import retrofit2.http.FormUrlEncoded;
import retrofit2.http.GET;
import retrofit2.http.Headers;
import retrofit2.http.POST;
import retrofit2.http.PUT;
import retrofit2.http.Path;
import retrofit2.http.Query;

/**
 * 创建者     庄丰泽
 * 创建时间   2018/5/18 14:39
 * 描述
 */


public interface ApiService {
    //验证图片验证码
    @GET("/captcha/image")
    Observable<Response<ImageCode>> checkImgVerificationCode();
    //非登录状态获取验证码
    @Headers({"Content-type:application/json;charset=UTF-8"})
    @POST("/captcha/sms")
    Observable<Response<User>> getMobileCode(@Body RequestBody route);
    //登录
    @Headers({"Content-type:application/json;charset=UTF-8"})
    @POST("/token/login")
    Observable<Response<User>> login(@Body RequestBody route);
    //注册
    @Headers({"Content-type:application/json;charset=UTF-8"})
    @POST("/user/register")
    Observable<Response<User>> Rigister(@Body RequestBody route);
    //修改密码
    @Headers({"Content-type:application/json;charset=UTF-8"})
    @PUT("/user/password")
    Observable<Response<User>> findPassword(@Body RequestBody route);

    //提币
    @Headers({"Content-type:application/json;charset=UTF-8"})
    @POST("/user/register")
    Observable<Response<User>> takeMoney(@Field("token") String userPhone, @Field("code") String code);
    //公告
    @GET("/message/notic/list/{language}")
    Flowable<Response<Notice>> getNotice(@Path("language") String language);

    //刷新token
    @GET("/token/refresh")
    Flowable<Response<Token>> refreshToken();

    //获取交易验证码
    @Headers({"Content-type:application/json;charset=UTF-8"})
    @POST("/captcha/jwt/sms")
    Observable<Response<User>> getDealMobileCode();
    //获取城市币数量
    @GET("/coin-api/citytoken/info")
    Flowable<Response<UserCitymoneyInfo>> getUserCityMoneyInfo();
    //获取配置信息
    @FormUrlEncoded
    @POST("/coin-api/config")
    Observable<Response<String>> getConfig(@Field("key") String key_value);

    //TODO: 2018/8/21 修改钱包保存的返回内容
    @Headers({"Content-type:application/json;charset=UTF-8"})
    @POST("/twallet")
    Flowable<Response<String>> saveWallet(@Body RequestBody route);

    @Headers({"Content-type:application/json;charset=UTF-8"})
    @DELETE("/twallet")
    Flowable<Response<String>> deleteWallet(@Body RequestBody route);

    //兑换糖果
    @FormUrlEncoded
    @POST("/coin-api/candy/exchange")
    Observable<Response<User>> ChangeSweet(@Field("CandyNum") int useridbody);

    //首页获取更多糖果
    @Headers({"Content-type:application/json;charset=UTF-8"})
    @GET("/coin-api/candy/statistics")
    Flowable<Response<List<CandyTask>>> getCandyTask();

    //获取用户的糖果数量
    @GET("/coin-api/candy/info")
    Flowable<Response<UserCandyInfo>> getUserCandyInfo();
}
